package com.hutianao.gqgl.information.gdp.service.impl;

import com.hutianao.gqgl.information.gdp.entity.SearchGdpEntity;
import com.hutianao.gqgl.information.gdp.respository.GdpDao;
import com.hutianao.gqgl.information.gdp.service.GdpService;
import com.hutianao.gqgl.mybatis.entity.GdpEntity;

import com.hutianao.gqgl.mybatis.flexigrid.PaddingEntity;
import com.hutianao.gqgl.mybatis.flexigrid.PadingRstType;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class GdpServiceImpl implements GdpService {
    @Resource
    private GdpDao GdpDao;

    @Override
    public PadingRstType<GdpEntity> queryGdpInfoListByPage(SearchGdpEntity search, PaddingEntity padding) {
        padding.deal(GdpEntity.class);
        PadingRstType<GdpEntity> padingRstType = new PadingRstType<>();
        padingRstType.setPage(padding.getPage());
        List<GdpEntity> list = GdpDao.queryGdpInfoListByPage(search,padding);
        padingRstType.setRawRecords(list);
        Integer total = GdpDao.queryGdpInfoTotal(search);
        padingRstType.setTotal(total);
        padingRstType.putItems();

        return padingRstType;
    }
}
